import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import { plugin as mdPlugin } from 'vite-plugin-markdown';
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    uni(),
    mdPlugin({
      mode: 'html', // 将 .md 转换为 HTML 字符串
      markdown: (body) => {
        // 自定义解析逻辑（如代码高亮）
        const marked = require('marked');
        const hljs = require('highlight.js');
        marked.setOptions({
          highlight: (code) => hljs.highlightAuto(code).value
        });
        return marked.parse(body);
      }
    })
  ],
  assetsInclude: ['**/*.md'] // 声明 .md 为静态资源
})
